import { createRouter, createWebHashHistory } from 'vue-router'
import store from '@/store/index'

const routes = [
  {
    path: '/',
    name: 'Home',
    meta: { title: '2020宝姐荟年度巡展', isAlways: false, keepAlive: false },
    component: () => import('@/views/Home')
  },
  {
    path: '/activity',
    name: 'Activity',
    meta: { title: '巡展活动', isAlways: true, keepAlive: false },
    component: () => import('@/views/Activity')
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

router.beforeEach((to, from, next) => {
  store.commit('titleConfig', {title: to.meta.title, isAlways: to.meta.isAlways})
  next()
})

export default router
